package huoye.shops.huoye.mine.activity;

import android.support.annotation.Nullable;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.codeideology.android.AXIFragmentPagerAdapter;
import com.codeideology.android.lang.entity.Paging;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.base.BaseActivity;
import huoye.shops.base.PullToRefreshActivity;
import huoye.shops.huoye.mine.adapter.RecordPayAdapter;
import huoye.shops.huoye.mine.fragment.RecordPayFragment;
import huoye.shops.huoye.mine.model.PostDepositRec;
import huoye.shops.huoye.mine.presenter.RecordPayPresenter;
import huoye.shops.huoye.mine.view.IRecordPayRefreshView;
import huoye.shops.huoye.operation.fragment.QueueShopFragment;
import huoye.shops.huoye.operation.model.ManageEventData;
import huoye.shops.utils.StockUtils;

public class RecordPayActivity extends BaseActivity {

    @BindView(R.id.base_toolbar_tl)
    TabLayout tl;
    @BindView(R.id.base_toolbar_vp)
    ViewPager vp;



    List<Fragment> fragments = new ArrayList<>();
    List<String> titles = new ArrayList<>();
    AXIFragmentPagerAdapter myFragmentPagerAdapter;


    @Override
    protected int getContentViewId() {
        return R.layout.activity_manage_sell;
    }

    @Override
    protected void initView(@Nullable Bundle bundle) {
        initUI();
    }

    private void initUI(){

        setTitle("收支记录");
        fragments.add(RecordPayFragment.getInstan(RecordPayFragment.TYPE_RECPRD_PAY_ALL));
        fragments.add(RecordPayFragment.getInstan(RecordPayFragment.TYPE_RECPRD_PAY_WITHDRAW));
        fragments.add(RecordPayFragment.getInstan(RecordPayFragment.TYPE_RECPRD_PAY_SELL));
        fragments.add(RecordPayFragment.getInstan(RecordPayFragment.TYPE_RECPRD_PAY_PUSH));


        titles.add(getString(R.string.operation_all));
        titles.add(getString(R.string.mine_withdraw));
        titles.add(getString(R.string.mine_sell));
        titles.add(getString(R.string.mine_push));


        StockUtils.reflex(tl);
        myFragmentPagerAdapter = new AXIFragmentPagerAdapter(getSupportFragmentManager(),fragments, titles);
        vp.setAdapter(myFragmentPagerAdapter);
        vp.setOffscreenPageLimit(fragments.size());
        tl.setupWithViewPager(vp);

    }

    @Override
    protected void onTopLeftBtnClick() {
        super.onTopLeftBtnClick();
        finish();
    }
}
